.camera-view-card {
  height: 100%;
}

.camera-view-card .ant-card-body {
  padding: 16px;
  height: calc(100% - 57px);
}

.camera-container {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.camera-wrapper {
  flex: 1;
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
  min-height: 200px;
  cursor: crosshair;
}

.camera-feed {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: opacity 0.3s ease;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.camera-feed.frozen {
  cursor: crosshair;
  border: 2px solid #4fc3f7;
  box-shadow: 0 0 10px rgba(79, 195, 247, 0.5);
}

.roi-selection {
  border: 2px dashed #4fc3f7;
  background: rgba(79, 195, 247, 0.2);
  pointer-events: none;
  z-index: 10;
  box-shadow: 0 0 10px rgba(79, 195, 247, 0.5);
}

.sync-status {
  margin-top: 12px;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
}

.sync-status:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* ROI模式提示 */
.camera-wrapper::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(79, 195, 247, 0.1);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 5;
}

.camera-wrapper:hover::before {
  opacity: 1;
}

/* 当处于ROI模式时的样式 */
.camera-wrapper.roi-mode {
  border: 2px solid #4fc3f7;
  box-shadow: 0 0 15px rgba(79, 195, 247, 0.5);
}

.camera-wrapper.roi-mode::after {
  content: '拖拽选择ROI区域';
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(79, 195, 247, 0.9);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  z-index: 15;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .camera-wrapper {
    min-height: 150px;
  }
  
  .sync-status {
    font-size: 12px;
    padding: 6px 10px;
  }
  
  .camera-view-card .ant-card-extra {
    margin-left: 8px;
  }
  
  .camera-view-card .ant-card-extra .ant-btn {
    font-size: 12px;
    height: 28px;
    padding: 0 8px;
  }
}

@media (max-width: 480px) {
  .camera-wrapper {
    min-height: 120px;
  }
  
  .sync-status {
    font-size: 11px;
    padding: 4px 8px;
    margin-top: 8px;
  }
  
  .camera-view-card .ant-card-body {
    padding: 12px;
  }
  
  .camera-view-card .ant-card-extra .ant-btn {
    font-size: 11px;
    height: 24px;
    padding: 0 6px;
  }
}

/* 加载状态动画 */
@keyframes pulse-loading {
  0% {
    opacity: 0.6;
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0.6;
  }
}

.camera-feed[src*="video_feed"]:not([src*="t="]) {
  animation: pulse-loading 1.5s infinite;
}

/* 错误状态样式 */
.camera-wrapper.error {
  border: 2px solid #f44336;
  background: rgba(244, 67, 54, 0.1);
}

.camera-wrapper.error::after {
  content: '摄像头连接失败';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(244, 67, 54, 0.9);
  color: white;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  z-index: 15;
}

/* 连接成功状态样式 */
.camera-wrapper.connected {
  border: 1px solid rgba(76, 175, 80, 0.3);
  box-shadow: 0 0 5px rgba(76, 175, 80, 0.2);
}

/* 工具提示样式 */
.camera-wrapper[title] {
  position: relative;
}

.camera-wrapper[title]:hover::before {
  content: attr(title);
  position: absolute;
  bottom: -30px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  white-space: nowrap;
  z-index: 20;
}
